<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
${aier_doctype}
<html <s:property value="aier_html_xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<title>${aier_title}</title>
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/jq.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/multiselect.css" />
<link rel="stylesheet" href="${aier_css_url}jc/chosen.css">
<link rel="stylesheet" href="${aier_css_url}social/module/jq-msg.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/reset.css" />
<link rel="stylesheet" href="${aier_css_url}social/school/common.css" />
<link rel="stylesheet" href="${aier_css_url}social/school/smanage.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}${aier_jqui_js}ui.js"></script>
<script type="text/javascript" src="${aier_js_url}97/WdatePicker.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/ja.js"></script>
<script type="text/javascript" src="${aier_js_url}jc/cj.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/multiselect.js"></script>
<script type="text/javascript" src="${aier_js_url}social/school/attend/tealea.js"></script>
</head>
<script type="text/javascript">
	var global_suffix = "${aier_suffix}", global_url = "${aier_url}", global_uri = "${aier_uri}", global_urijs = "${aier_urijs}", 
		global_sid = "${sid}", global_tid = "${tid}";
</script>
<!-- 教师请假管理 -->
<body>

	<!-- 顶栏 -->
	<s:action name="userhomecomm_homeHead" namespace="/user"
		executeResult="true"></s:action>

	<!-- 正文 -->
	<div id="hfContent" class="ar-content">
		<div class="content-main">
			<!-- 学校名称栏 -->
			<s:action name="scomm_schoolMTitle" namespace="/school"
				executeResult="true"></s:action>
			<div class="main-content wrap-bg clearfix">
				<!-- 左侧栏 -->
				<s:action name="scomm_teacherMLeft" namespace="/school" executeResult="true"></s:action>
				<!-- 右侧内容 -->
				<div class="ae-right">
					<div class="right-main">
						<div class="right-main-top">
							<div class="binfo-title">
								<h3>请假管理</h3>
							</div>
							<div class="right-line"></div>
						</div>
						<div class="right-main-c">
							<div class="info-tab01">
								<table id="inviteParTable">
									<tbody>
										<tr>
											<th class="gray6">起始时间：</th>
											<td><input type="text" id="startTime" class="PY-input"
												onfocus="WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})" />
											</td>
											<th class="gray6">结束时间：</th>
											<td><input type="text" id="EndTime" class="PY-input"
												onfocus="WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})" />
											</td>

										</tr>
										
										<tr>
											<th class="gray6">请假类型：</th>
											<td><select id="leave_type_handle" class="chosen">
													<option value="-1">请选择</option>
													<c:forEach var="leaveHandle" items="${leaveTypeHandleMap }">
														<option value="${leaveHandle.key}">${leaveHandle.value}</option>
													</c:forEach>
											</select></td>
											<td align="right" colspan="2"><button onclick="search()" style="margin-left: 120px;margin-top: 13px;"
												class="b_lmSel ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
												role="button" aria-disabled="false">
												<span class="ui-button-text">查询</span>
											</button></td>
										</tr>
										<tr>
											<th class="gray6"></th>
											<td></td>
											<th class="gray6">请假操作：</th>
											<td ><a id="b_lmadd" href="javascript:;"
												class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only fr"
												role="button" aria-disabled="false"><span
													class="ui-button-text">添加请假</span> </a> </td>
										</tr>
									</tbody>

								</table>
							</div>
							<div class="right-main-down">
								<div class="down-line"></div>

								<div class="down-inre">
									<table id="leaveinfo"></table>
									<div id="leavepage"></div>
								</div>
							</div>
						</div>
					</div>
				</div>

			</div>

		</div>
		<!-- footer copyright -->
		<s:action name="userhomecomm_homeFooter" namespace="/user" executeResult="true"></s:action>
		<!-- /footer copyright -->
	</div>

	<!-- 弹出层添加请假 -->
	<div id="d_leaveadd" style="display: none;" title="添加请假">
		<div class="info-tab01">
			<table>
				<tbody>
					<tr>
						<th class="gray6">请假类型：</th>
						<td colspan="3">
							<div class="d-type">
								<s:radio name="sel_type_resone" list="leaveTypeResoneMap" listKey="key" listValue="value" value="2" ></s:radio>
							</div></td>
					</tr>
					<tr>
						<th class="gray6">开始时间：</th>
						<td><input type="text" id="txt_addst" class="PY-input"
							onfocus="WdatePicker({skin:'twoer',startDate:'%y-%M-%d %H:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})" />
						</td>
						<th class="gray6">结束时间：</th>
						<td><input type="text" id="txt_addet" class="PY-input"
							onfocus="WdatePicker({skin:'twoer',startDate:'%y-%M-%d %H:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})" />
						</td>
					</tr>
					<tr>
						<th class="gray6" valign="top">请假原因：</th>
						<td colspan="3"><textarea id="txt_desinfo" rows="4" cols="61"
								style="resize: none;"></textarea></td>
					</tr>

				</tbody>
			</table>
		</div>
	</div>


	<!-- 撤销请假弹出层 -->
	<div id="leave_del" style="display: none;" title="撤销请假">
		您确定要将<span id="deltname"></span> 的这条请假信息撤销吗?
	</div>

	



</body>
<script type="text/javascript">
	$(".chosen").chosen();
	//查询请假列表信息
	function search(){
		var type_handle = $('#leave_type_handle  option:selected').val();
		var txt_sdate = $('#startTime').val();
		var txt_edate = $('#EndTime').val();
		jQuery("#leaveinfo").jqGrid('setGridParam',{url:"${aier_url}${aier_urijs}schoollea_searchLeaList_normal${aier_suffix}?sid="+global_sid+"&tid="+global_tid
			+"&type_handle="+type_handle+"&txt_sdate="+txt_sdate+"&txt_edate="+txt_edate,page:1}).trigger("reloadGrid");
	}

	//添加请假
	function addTel(){
		var type_resone = $("input[name='sel_type_resone']:checked").val();
		var txt_sdate_add = $('#txt_addst').val();
		var txt_edate_add = $('#txt_addet').val();		
		var txt_desinfo = $('#txt_desinfo').val();	
		if(txt_sdate_add.trim()==""){
			$().message("请输入请假开始时间");
			return
		}
		if(txt_edate_add.trim()==""){
			$().message("请输入请假结束时间");
			return
		}
		if(txt_edate_add<txt_sdate_add){
			$().message("结束时间必须大于等于开始时间");
			return
		}
		if(txt_sdate_add<curtime){
			$().message("今天之前的请假 请走补假流程");
			return
		}
		var fun = function(data) {
			if(1==data.s){
				$().message("添加成功,您可以继续添加!");
				$("#leaveinfo").trigger("reloadGrid");
			}else{
				$().message("添加失败,请稍后再试!");
			}
		};
		exeAjax(ajaxUrl("${aier_url}${aier_urijs}schoollea_add_normal${aier_suffix}"), fun, 
			{"sid" : global_sid,"tid" :global_tid,"txt_sdate":txt_sdate_add,"txt_edate":txt_edate_add,"type_resone":type_resone,"txt_desinfo":txt_desinfo});
				
	}


	// 请假弹出层
	$(function() {
		$("#d_leaveadd").dialog({
			//背景变暗
			modal: true,
			autoOpen : false,
			show : "blind",
			//hide : "explode",
			width : "635",
			height : "353",
				buttons: {
					"添加": function() {
						addTel();
					},"取消": function() {
						$( this ).dialog( "close" );
					}
				}
		});

		$("#b_lmadd").click(function() {
			$("#d_leaveadd").dialog("open");
			return false;
		});
	});


	
</script>
</html>